﻿//------------------------------------------------------------------------------
// <copyright file="IPepperService2.cs" company="Robert MacLean">
//      Copyright © Robert MacLean.  All Rights Reserved.
// </copyright>
//
//  Details on this see: http://pepper.codeplex.com
//  This code released under the terms of the 
//  Microsoft Public License  (MS-PL, http://opensource.org/licenses/ms-pl.html.)
//------------------------------------------------------------------------------

namespace Pepper
{
    using System;
    using System.ServiceModel;
    using Pepper.Exceptions;

    [ServiceContract]
    public interface IPepperService2
    {
        [OperationContract]
        [FaultContract(typeof(InvalidCredentialsFault))]
        Guid Login(string emailAddress, string passwordHash);

        [OperationContract]
        [FaultContract(typeof(InvalidCredentialsFault))]
        [FaultContract(typeof(NoSettingsFault))]
        Tuple<byte[], string> LoadSettings(Guid userId, string passwordHash);

        [OperationContract]
        [FaultContract(typeof(InvalidCredentialsFault))]
        [FaultContract(typeof(NoSettingsFault))]
        [FaultContract(typeof(NotPublicSettingsFault))]
        Tuple<byte[], string> LoadPublicSettings(Guid publicSettingId);

        [OperationContract]
        [FaultContract(typeof(InvalidCredentialsFault))]
        void SaveSettings(Guid userId, string passwordHash, byte[] settings, string settingsHash, bool publicSettings);

        [OperationContract]
        [FaultContract(typeof(InvalidCredentialsFault))]
        bool SettingsExist(Guid userId, string passwordHash);

        [OperationContract]
        [FaultContract(typeof(InvalidCredentialsFault))]
        [FaultContract(typeof(NoSettingsFault))]
        void ClearSetting(Guid userId, string passwordHash);       
       
        [OperationContract]
        int SettingsCount();

        [OperationContract]       
        [FaultContract(typeof(NoSettingsFault))]
        bool AreSettingsPublic(Guid publicSettingId);
    }
}
